﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Remoting.Messaging;

namespace QRCode.BusinessLayer
{
    public class ContextFactory
    {
        /// <summary>
        /// 获取当前线程的数据上下文
        /// </summary>
        /// <returns>数据上下文</returns>
        public static QRCodeContext CurrentContext()
        {
            QRCodeContext _qContext = CallContext.GetData("QRCodeContext") as QRCodeContext;
            if (_qContext == null)
            {
                _qContext = new QRCodeContext();
                CallContext.SetData("QRCodeContext", _qContext);
            }
            return _qContext;
        }
    }
}
